interface ISuggest {
    content: string;
    description: string;
}
interface IList {
    [key: string]: ISuggest[]
}

export default function onInputChangedFn(text: string, suggest: (suggestResults: chrome.omnibox.SuggestResult[]) => void) {
    console.log('inputChanged: ' + text);
    var list: IList = {
        '后台': [
            { content: '天猫' + text, description: '你要找“天猫”吗？' },
            { content: '京东' + text, description: '你要找“京东”吗？' },
            { content: '拼多多' + text, description: '你要找“拼多多”吗？' },
            { content: '电商bat' + text, description: '你要找“电商bat”吗？' }
        ],
        '微博': [
            { content: '新浪' + text, description: '新浪' + text },
            { content: '腾讯' + text, description: '腾讯' + text },
            { content: '搜狐' + text, description: '搜索' + text },
        ]
    }

    if (list[text]) {
        suggest(list[text])
    } else {
        suggest([
            { content: '百度搜索 ' + text, description: '百度搜索 ' + text },
            { content: '谷歌搜索 ' + text, description: '谷歌搜索 ' + text },
        ]);

    }
}
